<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<c:set var="ctx" value="${pageContext.request.contextPath}"/>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>修改厂商</title>
	<jsp:include page="../../import.jsp" flush="true"/>
	<script type="text/javascript" src="<%=path %>/resource/lib/plugins/ajaxfileupload.js"></script>
</head>
<body class="iframeBody">
<div class="Wrapper">
	<div id="pageInTab" class="pageInTab">
		<div tabid="tabA" title="基本信息" lselected="true">
			<form id="formSet1">
				<div class="fieldset1 tabel_col clearFix">
					<div class="caption">
						<span class="title">基本信息</span>
					</div>
					<div class="fieldBox col_50">
						<div class="label">厂商名称</div>
						<div class="field">
							<span name="mfrName" id="mfrName">&nbsp;</span>
							<input name="mId" id="mId" type="hidden" value="${id }">
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">社会统一信用代码</div>
						<div class="field">
							<span name="succ" id="succ">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">厂商地址</div>
						<div class="field">
							<span name="mfrAddr" id="mfrAddr">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">办公电话</div>
						<div class="field">
							<span name="mfrTel" id="mfrTel">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">区域</div>
						<div class="field">
							<!-- <input name="rgnPrCd" id="rgnPrCd" type="text" class="ui-textbox" value=""> -->
							<jsp:include page="../../system/sysRegion/region.jsp"
										 flush="true">
								<jsp:param name="regionShowLvl" value="2" />
							</jsp:include>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">
							<span class="sqiconfont sqicon-tishi c_sqYellow gridTip" title="说明：厂商金融业务放款时，用于判断放款金额是否扣除贴息费用项。"></span>放款方式
						</div>
						<div class="field">
							<span name="payTypCdNm" id="payTypCdNm">&nbsp;</span>
						</div>
					</div>
					<div class="caption">
						<span class="title">更多信息</span>
					</div>
					<div class="fieldBox col_33">
						<div class="label">经销品牌(卡车类)</div>
						<div class="field">
							<span name="tkBrCdNms" id="tkBrCdNms">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">经销品牌(乘用车类)</div>
						<div class="field">
							<span name="carBrCdNms" id="carBrCdNms">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">经销品牌(客车类)</div>
						<div class="field">
							<span name="busBrCdNms" id="busBrCdNms">&nbsp;</span>
						</div>
					</div>
				</div>
				<div class="sqPanel">
					<div class="sqPanel_head inL">
						<span>社会关系/家庭成员</span>
					</div>
					<div class="sqPanel_body">
						<div id="ligergrid_A1" class="sq-grid"></div>
					</div>
				</div>
                <c:if test="${isBsc==1 }">
                    <div class="fieldset1 tabel_col tabel_col_s clearFix">
                        <div class="sqPanel">
                            <div class="sqPanel_head inL">
                                <span>变更资料</span>
                                <span class="btns"><span class="sq-button sq-button-round" onclick="downloadMfrFileByUrl();">打包下载</span></span>
                            </div>
                            <div class="sqPanel_body">
                                <div id="mfrFileInfoCfgGrid" class="sq-grid"></div>
                            </div>
                        </div>
                    </div>
                    <!-- 资料上传DIV -->
                    <div id="prj_file_div" style="display:none">
                        <form id="prj_file_formSet">
                            <div class="fieldset1 tabel_col noBorder clearFix">
                                <div class="fieldBox col_100">
                                    <jsp:include page="../../system/sysUlFilesRec/sysSysUlFilesRecUpload.jsp" flush="true" >
                                        <jsp:param name="fileNum" value="1"/>
                                        <jsp:param name="filePath" value="prjFileInfo"/>
                                    </jsp:include>
                                </div>
                            </div>
                            <input type="text" style="display: none;" id="cfgCd" name="cfgCd" value="${cfgCd}">
                            <input type="text" style="display: none;" id="cfgDtlCd" name="cfgDtlCd">
                            <input type="text" style="display: none;" id="orgCd" name="orgCd" value="${cfgOrgCd}">
                            <input name="mfrId" id="mfrId" type="hidden" value="${mfrId}"/>
                        </form>
                    </div>
                </c:if>

			</form>
		</div>
		<div tabid="tabB" title="资料信息">
			<iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
		</div>
		<div tabid="tabC" title="备案账号">
			<iframe frameborder="0" name="tabC" id="tabC" src=""></iframe>
		</div>
		<div tabid="tabD" title="流程跟踪">
			<iframe frameborder="0" name="tabD" id="tabD" src=""></iframe>
		</div>
		<div tabid="tabE" title="相关项目">
			<iframe frameborder="0" name="tabE" id="tabE" src=""></iframe>
		</div>
		<div tabid="tabF" title="变更记录">
			<iframe frameborder="0" name="tabF" id="tabF" src=""></iframe>
		</div>
	</div>
</div>
<script type="text/javascript">
    var loadedTabs=[];
    var mfrRlPsnGrid;
    var isFlow = '${isFlow}';
    var mfrId = '${mfrId}';
    var modId = '${modId}';
    var isModify = '${isBsc}';
    var isMdfPayTyp = '${isMdfPayTyp}';
    var currentOrgCd = '${currentOrgCd}';


    var _mfrId = '${mfrId}';
    var _isDetail = '${isDetail}';
    var _qualTypCd = '${qualTypCd }'; //经销商资质
    var _cfgSysCd = '${cfgSysCd}'; //附件系统CODE
    var _cfgOrgCd = '${cfgOrgCd}'; //附件组织架构
    var _tabNm = '${tabNm}'; //附件对应表
    var _cfgCd = '${cfgCd}'; //附件CODE
    var _modulePath = '${modulePath}';
    var _costomerPath = '${costomerPath}';
    var _rootPath = '${rootPath}';
    var _uploadSysCd = '${uploadSysCd}';
    var _isApply = '${isApply}';
    var _isCheckVerify = '${isCheckVerify}';

    var mfrFileInfoCfgGrid = null ;//资料配置明细
    var isMatchFileRec = '${isMatchFileRec}';

    $(function () {

        $("#formSet1").ligerForm({
            validate : true
        });

        initTab();
        initData();
        initMfrRlGrid();
        initMfrFileInfoCfgGrid();
    });

    //初始化Tab页
    function initTab(){
        pageInTab = $("#pageInTab").ligerTab({
            height: 'auto',
            contextmenu: false,
            minIframeHeight: 450,
            onBeforeSelectTabItem: function (tabid) {
                var _mId = mfrId;
                if(tabid!="tabA"){
                    if(!_mId){
                        top.$.ligerDialog.SQalert({content: "请确认厂商基本信息已存在", SQ_type: "warning"});
                        return false;
                    }
                }
            },
            onAfterSelectTabItem: function(tabid) {
                if (loadedTabs.indexOf(tabid)<0) {
                    var _mId = mfrId;
                    if(tabid!="tabA"){
                        if(!_mId){
                            top.$.ligerDialog.SQalert({content: "请确认厂商基本信息已存在", SQ_type: "warning"});
                            return false;
                        }
                    }
                    loadedTabs.push(tabid);
                    switch (tabid){
                        case "tabB": //厂商资料
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/mfr/mfrBscInfo/toMfrFileAddPage.do?mfrId="+ mfrId);
                            break;
                        case "tabC"://备案账号
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/mfr/mfrbankacc/toListPageDetail.do?isDetail=1&mfrId="+mfrId);
                            break;
                        case "tabD"://流程追踪
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/mfr/mfrBscInfo/toMfrFlowPage.do?mfrId="+mfrId);
                            break;
                        case "tabE"://相关项目
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/product/mfrInfo/toMfrPrjBscInfoDetailList.do?mfrId="+mfrId);
                            break;
                        case "tabF"://变更记录
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/mfr/mfrinfomoddtl/toListPage.do?modId="+ modId);
                            break;
                    }
                };
                SetIframe_height();
            }
        });
    };

    /**
     * 数据加载
     */
    function initData(){
        var id = mfrId;
        var currentOrgCd = '${currentOrgCd}';
        if(!id){
            return;
        }
        var _url = '<%=path%>/product/mfrInfo/getMfrInfoFlowById.do';
        $.ajax({
            type: 'get',
            dataType:'json',
            data:{id:id,modId:modId,currentOrgCd:currentOrgCd,isFlow:isFlow},
            url: _url,
            success:function(msg){
                if(msg.success == 1){
                    setData(msg.data);//设置数据
                }else{
                    $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //设置页面数据
    function setData(data){
        var form = new liger.get("formSet1");
        $("#mfrName").html(data.mfrName);
        $("#mfrAddr").html(data.mfrAddr);
        //$("#mfrFax").html(data.mfrFax);
        $("#mfrTel").html(data.mfrTel);
        $("#succ").html(data.succ);
        $("#payTypCdNm").html(data.payTypCdNm);

        //区域数据处理
        setRgnProvCdUpdataValue(data.rgnPrCd);
        setRgnCityCdUpdataValue(data.rgnCyCd);
        setRegionSelectDataChange();
        disabledRgnProvCd();
        disabledRgnCityCd();

        //$("#rgnNms").html(data.rgnNms);
        $("#tkBrCdNms").html(data.tkBrCdNms);
        $("#carBrCdNms").html(data.carBrCdNms);
        $("#busBrCdNms").html(data.busBrCdNms);
        $("#otherInfo").html(data.otherInfo);
    };

    //初始化主要人员信息
    function initMfrRlGrid() {
        var _mId = mfrId;
        var _audStsCd = 1;
        var _url = '<%=path%>/mfr/mfrrlpsn/initListFlow.do?';
        if(isModify && isModify != 1){
            _url = '<%=path%>/mfr/mfrrlpsn/initList.do?';
		}
        mfrRlPsnGrid = $("#ligergrid_A1").ligerGrid({
            url: _url,
            method : 'get',
            parms:{mfrId:_mId,modId:modId},
            async: false,
            columns: [
                { display: '联系人姓名', name: 'rlNm', minWidth: 100},
                { display: '联系人类型', name: 'rlTypCdNm', minWidth: 140},
                { display: '证件类型', name: 'certTypCdNm', minWidth: 140},
                { display: '证件号', name: 'certNo', minWidth: 50, render: function(rowdata, rowindex, value){
                        if (value != null && value != '') {
                            return '<a href="javascript:toCertNoCheckPage(\''+value+'\');" class="sq-button-hasicon link">'
                                + '<i class="sqBtnIco_1"></i></a>'
                                + value;
                        }
                    }},
                { display: '联系电话', name: 'tel', minWidth: 150},
                { display: '备注', name: 'rlRem', minWidth: 150},
                { display: '工商信息校验', name: 'checkVerify', minWidth: 150,
                    render: function(rowdata, rowindex, value){
                        var h = "";
                        if(_audStsCd == 1 && isModify && isModify == 1 && isFlow && isFlow == 1){
                            if(rowdata.busInfoVerify == 2 || rowdata.busInfoVerify == null){
                                h+= '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(1,\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\',\''+rowdata.rlTypCd+'\');">验证</a>'
                            }else{
                                h +='<div class="sq-button sq-button-round disabled">已校验</div>'
                            }
                        }
                        return h;
                    }
                },
                { display: '工商信息校验结果', name: 'busInfoVerify', minWidth: 150,
                    render: function(rowdata, rowindex, value){
                        if(rowdata.busInfoVerify == 1){
                            return "一致" ;
                        }else if(rowdata.busInfoVerify == -1){
                            return "不一致";
                        }else if(rowdata.busInfoVerify == 0){
                            return "未查得";
                        }else{
                            return "";
                        }
                    }
                },
                { display: '三要素校验（机构1）', name: 'PYCheck', minWidth: 150,
                    render: function(rowdata, rowindex, value){

                        var h = "";
                        if(_audStsCd == 1 && isModify && isModify == 1 && isFlow && isFlow == 1){
                            if(rowdata.pyPerVerify == 2 || rowdata.pyPerVerify == null){
                                //h += "<a  href = "javascript:checkRlPsn('Verify',\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\');" class = "sq-button sq-button-round">验证</a>"

                                h+= '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(2,\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\',\''+rowdata.rlTypCd+'\');">验证</a>'
                            }else{
                                h+='<div class="sq-button sq-button-round disabled">已校验</div>'
                            }
                        }
                        return h;
                    }
                },
                { display: '三要素校验结果1', name: 'pyPerVerify', minWidth: 150,
                    render: function(rowdata, rowindex, value){
                        if(rowdata.pyPerVerify == 1){
                            return "一致" ;
                        }else if(rowdata.pyPerVerify == -1){
                            return "不一致";
                        }else if(rowdata.pyPerVerify == 0){
                            return "未查得";
                        }else{
                            return "";
                        }
                    }
                },
                { display: '三要素校验（机构2）', name: 'TDCheck', minWidth: 150,
                    render: function(rowdata, rowindex, value){
                        var h = "";
                        if(_audStsCd == 1 && isModify && isModify == 1 && isFlow && isFlow == 1){
                            if(rowdata.tdPerVerify == 2 ||  rowdata.tdPerVerify == null){
                                h+= '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(3,\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\',\''+rowdata.rlTypCd+'\');">验证</a>'
                            }else{
                                h +='<div class="sq-button sq-button-round disabled">已校验</div>'
                            }
                        }
                        return h;
                    }
                },
                { display: '三要素校验结果2', name: 'tdPerVerify', minWidth: 150,
                    render: function(rowdata, rowindex, value){
                        if(rowdata.tdPerVerify == 1){
                            return "一致" ;
                        }else if(rowdata.tdPerVerify == -1){
                            return "不一致";
                        }else if(rowdata.tdPerVerify == 0){
                            return "未查得";
                        }else{
                            return "";
                        }
                    }
                },
                { display: '三要素校验（机构3）', name: 'BRCheck', minWidth: 150,
                    render: function(rowdata, rowindex, value){
                        var h = "";
                        if(_audStsCd == 1 && isModify && isModify == 1 && isFlow && isFlow == 1){
                            if(rowdata.brPerVerify == 2 || rowdata.brPerVerify == null){
                                h+= '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(4,\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\',\''+rowdata.rlTypCd+'\');">验证</a>'
                            }else{
                                h +='<input class="sq-button sq-button-round disabled" type="button" value="已校验" disabled>'
                            }
                        }
                        return h;
                    }
                },
                { display: '三要素校验结果3', name: 'brPerVerify', minWidth: 150,
                    render: function(rowdata, rowindex, value){
                        if(rowdata.brPerVerify == 1){
                            return "一致" ;
                        }else if(rowdata.brPerVerify == -1){
                            return "不一致";
                        }else if(rowdata.brPerVerify == 0){
                            return "未查得";
                        }else{
                            return "";
                        }
                    }
                },

            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: 300,
            heightDiff: -2,
            enabledEdit: true,
            isScroll: false,
            checkbox: false,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false,
            enabledSort:false,
            onAfterShowData: function() {
                SetIframe_height ();
            }
        });
    };

    /**
     * 初始化附件
     */
    function initMfrFileInfoCfgGrid(){

        //资料配置明细Grid
        mfrFileInfoCfgGrid = $("#mfrFileInfoCfgGrid").ligerGrid({
            url: '<%=path%>/mfr/mfrBscInfo/initMfrFileInfoList.do?mfrId='+modId+'&cfgCd='+_cfgCd +'&tabNm='+_tabNm +"&cfgSysCd="+_cfgSysCd+'&cfgOrgCd='+_cfgOrgCd,
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false},
                {display: '上传文件名称', name: 'fileNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
                {display: '操作', name: '', minWidth: 100,align: 'left',  enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(isModify && isModify == 1 && isFlow && isFlow == 1){
                                if(rowdata.fileId){
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',1);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',2);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                }
                        }
                        return h;
                    }
                },
                {display: '上传', name: 'uploadNm', width: 80,align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        return h;
                    }
                },
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function ()
            {
                $('#mfrFileInfoCfgGrid').rowspan('datNm');
                $('#mfrFileInfoCfgGrid').rowspan('uploadNm');
            }
        });
    }

    function onChangefile_multi(e,cfgCd,cfgDtlCd,orgCd,fileId,rowIndex) {
        var wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
        var filePath= _modulePath; //之前无 '/'
        $.ajaxFileUpload({
            url: '<%=path%>/system/sysulfilesrec/upload.do',
            secureuri: false,
            fileElementId: e.target.id,  //这里不在是以前的id了，要写成数组的形式！
            dataType: 'json',
            data: {filePath: filePath,costomerPath:_costomerPath,rootPath:_rootPath,uploadSysCd:_uploadSysCd},
            success: function (msg) {
                if (msg.success == 1) {
                    $.ajax({
                        type: 'post',
                        dataType: 'json',
                        data: {'fileParams':JSON.stringify(msg.data),'mfrId':modId,'cfgCd':cfgCd,'cfgDtlCd':cfgDtlCd,'orgCd':orgCd,'cfgSysCd':_cfgSysCd,'rootPath':_rootPath,'tabNm':_tabNm,"fileId":fileId},
                        url: '<%=path%>/mfr/mfrBscInfo/addMfrFileList.do',
                        success: function (msg) {
                            if (msg.success == 1) {
                                mfrFileInfoCfgGrid.reload();
                            }else{
                                $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
                            }
                            $.ligerDialog.hide();
                        }
                    });
                } else {
                    wait_dialog.close();
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    };

    //修改资料的验证状态
    function modifyAudStsCd(event,_fileId,_audStsCd){
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {'fileId':_fileId,'audStsCd':_audStsCd},
            url: '<%=path%>/mfr/mfrBscInfo/modifyFileAudStsCd.do',
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    //$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    event.stopPropagation();
                    var gridID = $(event.target).parents('.sq-grid').attr('ligeruiid');
                    liger.get(gridID).reload();
                }else{
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //删除文件
    function delFile(event,_fileId){
        top.$.ligerDialog.confirm("确认删除吗?", function (flag) {
            if(!flag){
                return;
            }else{
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    data: {'fileId':_fileId},
                    url: '<%=path%>/mfr/mfrBscInfo/removeFile.do',
                    beforeSend: function () {
                        wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                    },
                    success: function (msg) {
                        wait_dialog.close();
                        if (msg.success == 1) {
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                            event.stopPropagation();

                            var gridID = $(event.target).parents('.sq-grid').attr('ligeruiid');
                            liger.get(gridID).reload();
                        }else{
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                        }
                    }
                });
            }
        });
    }

    function downloadMfrFileByUrl() {
        var data = mfrFileInfoCfgGrid.getData();
        //var files = [];
        var ids = [];
        for (var i = 0; i < data.length; i++) {
            var map = {};
            if(StringUtils.isNotEmpty(data[i].fileId)){
                ids.push(data[i].fileId);
            }
        }
        var actoinURL = '<%=path%>/system/sysulfilesrec/zipDownloadById.do?';
        var form = $("<form>");
        $('body').append(form);
        form.attr('style','display:none');
        form.attr('target','');
        form.attr('method','post');
        form.attr('action',actoinURL);//下载文件的请求路径
        var input = $('<input>');
        input.attr('type','hidden');
        input.attr('name','ids');
        input.attr('value',JSON.stringify(ids));
        form.append(input);
        form.submit();
    }

    //图片展示
    function showImg(e){
        e.preventDefault();
        var href = $(e.target).attr('src');
        if(!href){
            return;
        }
        if(SQ.regs.img.test(href)){
            var imgSrc = $(e.target).attr('src'),
                imgTit = $(e.target).attr('title');
            window.__ImgSrc = imgSrc;
            window.__ImgTit = imgTit;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
        }
    }

    //删除文件
    function removeFileRec(event,_fileId){
        top.$.ligerDialog.confirm("确认删除吗?", function (flag) {
            if(!flag){
                return;
            }else{
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    data: {'fileId':_fileId},
                    url: '<%=path%>/mfr/mfrBscInfo/removeFile.do',
                    beforeSend: function () {
                        wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                    },
                    success: function (msg) {
                        wait_dialog.close();
                        if (msg.success == 1) {
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                            refreshUlFileRecList();//刷新文件列表
                            clearUploadResultParams();//清除上传结果参数

                            var gridID = $(event.target).parents('.sq-grid').attr('ligeruiid');
                            liger.get(gridID).reload();
                            //var gridID = $(event.target).parents('.sq-grid').attr('ligergrid1');
                            //liger.get(gridID).reload();
                        }else{
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                        }
                    }
                });
            }
        });
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }

    function uploadFileByUrl(_url,_name){
        if(SQ.regs.img.test(_name)){
            //SQ.imgPreview(_url);
            //SQ.imgPreview(_url, true);
            window.__ImgSrc = _url;
            window.__ImgTit = _name;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
        }else{
            window.open(_url);
        }
    }

    /**
     * 三要素校验
     * @param type
     * @param dataId
     * @param rlNm
     * @param certNo
     * @param tel
     * @param rlTypCd
     */
    function checkRlPsn(type,dataId,rlNm,certNo,tel,rlTypCd){
        var _type ;
        if(type == 1){
            _type = 'verify' ;
        }
        if(type == 2){
            _type = 'PY' ;
        }
        if(type == 3){
            _type = 'TD' ;
        }
        if(type == 4){
            _type = 'BR' ;
        }
        var _url = '<%=path%>/mfr/mfrBscInfo/checkRlPsn.do';
        $.ajax({
            type: 'post',
            dataType : 'json',
            data:{
                type:_type,
                rlPsnId:dataId,
                rlNm:rlNm,
                certNo:certNo,
                tel:tel,
                mfrId:mfrId,
                modId:modId,
                rlTypCd:rlTypCd,
                applyPsnId:dataId  //如果变更流程，需要加上
            },
            url:_url,
            success:function(msg){
                if(msg.success == 1){
                    initMfrRlGrid();
                }else{
                    initMfrRlGrid()
                }
            }
        });
    }

</script>
</body>
</html>